num = int(input("请输入要转换的数据：\n"))
change = input("选择要改变的进制：二，八，十，十六\n")
if change == '2':
    print(f"进制转换后的数据为：{bin(num)}")
elif change == '8':
    print("进制转换后的数据为：%s" % (oct(num)))
elif change == '10':
    print("进制转换后的数据为：%d" % (int(num)))
elif change == '16':
    print("进制转换后的数据为:{}".format(hex(num)))

import time
incomplete_sign = 50
print('='*23+'开始下载'+'='*25)
for i in range(incomplete_sign + 1):
    completed = "*" * i
    incomplete = "." * (incomplete_sign - i)
    percentage = (i / incomplete_sign) * 100
    print("\r{:.0f}%[{}{}]".format(percentage, completed, incomplete), end="")
    time.sleep(0.5)
print("\n" + '=' *23+'下载完成'+'='*25)

sensitive_character = '你好'
test_sentence = input('请输入一段话：')
for line in sensitive_character:
    if line in test_sentence:
        test_sentence = test_sentence.replace(line, '*')
print(test_sentence)

string = "他问，你知道cba是什么单词的缩写么    ？    "
print(string)
print('1.删除空格')
print('2.英文标点替换')
print('3.首字母大写')
print('4.退出')
while True:
    option = input("请输入功能选项：\n")
    if option == '1':
        string = string.replace(' ', '')
        print(string)
    elif option == '2':
        for i in string:
            if i == ',':
                string = string.replace(',', '，')
            elif i == '.':
                string = string.replace('.', '。')
            elif i == '?':
                string = string.replace('?', '？')
            elif i == "'":
                string = string.replace("'", "‘")
        string = string
        print(string)
    elif option == '3':
        string = string.upper()
        print(string)
    elif option == '4':
        break

text = " Python document "
print(text[:5])
text = text.strip()
print(text)
print(text[12:])
print(text.index('d'))
text_split = text.split('o')
print(text_split)
text_replace = text.replace('o', 'p')
print(text_replace)
text_upper = text.upper()
print(text_upper)
text_lower = text.lower()
print(text_lower)
text_Py = text.strip().startswith("Py")
print(text_Py)
text_c = text.strip().endswith('c')
print(text_c)